package com.example.utils;

import com.example.domain.Result;

/**
 * 优化代码
 * Created by 李强 on 2017/5/7.
 */
public class ResultUtil {

    public static Result success(Object object){

        Result result = new Result();
        result.setMsg("成功");
        result.setCode(0);
        result.setData(object);
        return result;
    }

    public static Result success(){
        return success(null);
    }

    public static Result error(Integer code,String msg){

        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;

    }

}
